---@class RiichiMahjong.RoomBase : Base.RoomBase
local RoomBase = Fk.Base.RoomBase:subclass("RiichiMahjong.RoomBase")

local AskForTileReq = require "packages.mahjong.riichi_mahjong.core.handler.ui_emu.askfortile"
local AskForCallReq = require "packages.mahjong.riichi_mahjong.core.handler.ui_emu.askforcall"

-- 手写泛型 这里帮你写了

---@class RiichiMahjong.RoomBase
---@field public players RiichiMahjong.Player[]
---@field public observers RiichiMahjong.Player[]
---@field public current RiichiMahjong.Player
---@field public prevailing_wind integer @ 场风
---@field public first_round boolean @ 是否第一巡
---@field public player_tiles integer[] @ 玩家牌
---@field public shown_dora_num integer @ 已展示的宝牌指示牌数
---@field public getPlayerById fun(self: RiichiMahjong.RoomBase, id: integer): RiichiMahjong.Player
---@field public getPlayerBySeat fun(self: RiichiMahjong.RoomBase, seat: integer): RiichiMahjong.Player
---@field public setCurrent fun(self: RiichiMahjong.RoomBase, current: RiichiMahjong.Player)
---@field public getCurrent fun(self: RiichiMahjong.RoomBase): RiichiMahjong.Player

function RoomBase:initialize()
  Fk.Base.RoomBase.initialize(self)
  
  self:addRequestHandler("RiichiMahjong.AskForTile", AskForTileReq)
  self:addRequestHandler("RiichiMahjong.AskForCall", AskForCallReq)

  self.center = -1
end
---摸一张牌
---@param tile integer @ 牌id
---@param player RiichiMahjong.Player @ 玩家
function RoomBase:DrawTile(tile, player)
  if tile ~= -1 then
    table.insert(self.player_tiles, tile)
  end
  player.card_num = player.card_num + 1
end

function RoomBase:serialize()
  local o = Fk.Base.RoomBase.serialize(self)

  -- TODO

  return o
end

function RoomBase:deserialize(o)
  Fk.Base.RoomBase.deserialize(self, o)

  -- TODO
end

return RoomBase

